package chapter03

import org.apache.log4j.{Level, Logger}
import org.apache.spark.{SparkConf, SparkContext}

object Test27_SortByKey {
  def main(args: Array[String]): Unit = {
    Logger.getLogger("org.apache.spark").setLevel(Level.WARN)
    val conf = new SparkConf().setMaster("local[*]").setAppName("sortByKey")
    val sc = new SparkContext(conf)
    val value = sc.makeRDD(List(('a', 1), ('b', 1),
      ('a', 1), ('b', 1), ('b', 1)))
    val value1 = value.sortByKey()
    println(value1.collect().toList)
    val value2 = value.sortByKey(false)
    println(value2.collect().toList)
  }
}

